﻿

namespace ConsoleApplication1
{
    using System;
    using System.Drawing;
    using System.Drawing.Imaging;
    //using quickTest;
    //using QuickTest;
  
    


    internal class Program
    {
        private static void Main(string[] args)
        {
            try
            {
                string filename = args[0];
                string str2 = args[1];
                Bitmap bitmap = new Bitmap(Image.FromFile(filename));
                Bitmap bitmap2 = new Bitmap(Image.FromFile(str2));
                if ((bitmap.Width == bitmap2.Width) && (bitmap.Height == bitmap2.Height))
                {
                    int exitCode = 0;
                    Bitmap bitmap3 = new Bitmap(bitmap.Width, bitmap.Height);
                    for (int i = 0; i < bitmap.Width; i++)
                    {
                        for (int j = 0; j < bitmap.Height; j++)
                        {
                            if (bitmap.GetPixel(i, j).Name == bitmap2.GetPixel(i, j).Name)
                            {
                                bitmap3.SetPixel(i, j, Color.White);
                            }
                            else
                            {
                                exitCode = 1;
                                bitmap3.SetPixel(i, j, Color.Black);
                            }
                        }
                    }
                    try
                    {
                        string str3 = args[2];
                        bitmap3.Save(str3, ImageFormat.Jpeg);
                    }
                    catch
                    {
                    }
                    Environment.Exit(exitCode);
                }
                else
                {
                    Environment.Exit(2);
                }
            }
            catch
            {
                Environment.Exit(3);
            }
        }

 

 

           

    }
}
